# eric7.Graphics.ApplicationDiagramBuilder

Module implementing a dialog showing an imports diagram of the application.

### Global Attributes

None

### Classes

ApplicationDiagramBuilder | Class implementing a builder for imports diagrams of the application.

### Functions

None

## ApplicationDiagramBuilder

Class implementing a builder for imports diagrams of the application.

### Derived from

UMLDiagramBuilder

### Class Attributes

None

### Class Methods

None

### Methods

ApplicationDiagramBuilder | Constructor
__addPackage | Private method to add a package to the diagram.
__arrangeNodes | Private method to arrange the shapes on the canvas.
__buildModulesDict | Private method to build a dictionary of modules contained in the application.
__createAssociations | Private method to generate the associations between the module shapes.
__findApplicationRoot | Private method to find the application root path.
buildDiagram | Public method to build the packages shapes of the diagram.
fromDict | Public method to populate the class with data persisted by 'toDict()'.
parsePersistenceData | Public method to parse persisted data.
toDict | Public method to collect data to be persisted.

### Static Methods

None

#### ApplicationDiagramBuilder (Constructor)

ApplicationDiagramBuilder(dialog, view, project, noModules=False)

Constructor

dialog (UMLDialog)
  reference to the UML dialog
view (UMLGraphicsView)
  reference to the view object
project (Project)
  reference to the project object
noModules (bool)
  flag indicating, that no module names should be shown

#### ApplicationDiagramBuilder.__addPackage

__addPackage(name, modules, x, y)

Private method to add a package to the diagram.

name (str)
  package name to be shown
modules (list of str)
  list of module names contained in the package
x (float)
  x-coordinate
y (float)
  y-coordinate

Return:
  reference to the package item

Return Type:
  PackageItem

#### ApplicationDiagramBuilder.__arrangeNodes

__arrangeNodes(nodes, routes, whiteSpaceFactor=1.2)

Private method to arrange the shapes on the canvas.

The algorithm is borrowed from Boa Constructor.

nodes (list of str)
  list of nodes to arrange
routes (list of tuple of (str, str))
  list of routes
whiteSpaceFactor (float)
  factor to increase whitespace between items

#### ApplicationDiagramBuilder.__buildModulesDict

__buildModulesDict()

Private method to build a dictionary of modules contained in the application.

Return:
  dictionary of modules contained in the application

Return Type:
  dict

#### ApplicationDiagramBuilder.__createAssociations

__createAssociations(routes)

Private method to generate the associations between the module shapes.

routes (list of tuple of (str, str))
  list of associations

#### ApplicationDiagramBuilder.__findApplicationRoot

__findApplicationRoot()

Private method to find the application root path.

Return:
  application root path

Return Type:
  str

#### ApplicationDiagramBuilder.buildDiagram

buildDiagram()

Public method to build the packages shapes of the diagram.

#### ApplicationDiagramBuilder.fromDict

fromDict(_version, data)

Public method to populate the class with data persisted by 'toDict()'.

_version (str)
  version of the data (unused)
data (dict)
  dictionary containing the persisted data

Return:
  tuple containing a flag indicating success and an info message in case the diagram belongs to a different project

Return Type:
  tuple of (bool, str)

#### ApplicationDiagramBuilder.parsePersistenceData

parsePersistenceData(_version, data)

Public method to parse persisted data.

_version (str)
  version of the data (unused)
data (str)
  persisted data to be parsed

Return:
  flag indicating success

Return Type:
  bool

#### ApplicationDiagramBuilder.toDict

toDict()

Public method to collect data to be persisted.

Return:
  dictionary containing data to be persisted

Return Type:
  dict

Up